<template>
    <div id="temnum">
        <div class="subs div" @click="sub">-</div>
        <div class="num div" v-text="count"></div>
        <div class="add div" @click="add">+</div>
    </div>
</template>
<script>
    export default {
        data() {
            return {
                count:1,
            }
        },
        methods:{
            sub(){
                this.count--;
                if(this.count < 1){
                    this.count = 1;
                }
                this.sendata();
            },
            add(){
                this.count++;
                this.sendata();
            },
            sendata(){
                this.$emit('send',this.count)
            }
        }

    };
</script>
<style scoped>
    #temnum .div {
        display: inline-block;
        width: 50px;
        height: 25px;
        border:1px solid #000;  
        text-align: center;
        line-height: 25px; 
    }
    #temnum {
        margin-left: 30px;
    }
</style>